import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UnionlottoVO, UnionlottoForm, UnionlottoQuery } from '@/api/myprogram/unionlotto/types';

/**
 * 查询双色球列表
 * @param query
 * @returns {*}
 */

export const listUnionlotto = (query?: UnionlottoQuery): AxiosPromise<UnionlottoVO[]> => {
  return request({
    url: '/myprogram/unionlotto/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询双色球详细
 * @param id
 */
export const getUnionlotto = (id: string | number): AxiosPromise<UnionlottoVO> => {
  return request({
    url: '/myprogram/unionlotto/' + id,
    method: 'get'
  });
};

/**
 * 新增双色球
 * @param data
 */
export const addUnionlotto = (data: UnionlottoForm) => {
  return request({
    url: '/myprogram/unionlotto',
    method: 'post',
    data: data
  });
};

/**
 * 修改双色球
 * @param data
 */
export const updateUnionlotto = (data: UnionlottoForm) => {
  return request({
    url: '/myprogram/unionlotto',
    method: 'put',
    data: data
  });
};

/**
 * 删除双色球
 * @param id
 */
export const delUnionlotto = (id: string | number | Array<string | number>) => {
  return request({
    url: '/myprogram/unionlotto/' + id,
    method: 'delete'
  });
};

export const getUnionlottoFromWeb = () => {
  return request({
    url: '/myprogram/unionlotto/getUnionlottos',
    method: 'get'
  });
};
